package ch.il07.converter.presentation.beans;

import ch.il07.converter.business.ServiceFactoryAdapter;
import ch.il07.converter.business.UserBusiness;

/**
 * @author daVe™
 *
 */
public class RegisterBean {
	private String name;
	private String email;
	private String password;
	private String confirmedPassword;

	public RegisterBean() {
		
	}

	public String register() {
		String response = "failure";
		if(password.equals(confirmedPassword)) {
			UserBusiness userImpl = ServiceFactoryAdapter.getUserBusinessInstance();
			boolean result = userImpl.register(name, password, email, 0);			
			response = result ? "success" : "failure";
		}
		return response;
	}

	public String cancel() {
		return "cancel";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getConfirmedPassword() {
		return confirmedPassword;
	}

	public void setConfirmedPassword(String confirmedPassword) {
		this.confirmedPassword = confirmedPassword;
	}
}
